// miniprogram/pages/author/shorttime/shorttime.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    name:"",
    phone: "",
    peoplenum: "",
    reason: "",
  },
  bindSave:function(e){
    var name = e.detail.value.name;
    var phone = e.detail.value.phone;
    var peoplenum = e.detail.value.peoplenum;
    var reason = e.detail.value.reason;

    this.setData({
      name: name,
      phone: phone,
      peoplenum: peoplenum,
      reason: reason,
    })
  },
  give_author: function () {
    var that = this.data;

    app.globalData.name = that.name;
    app.globalData.phone = that.phone;
    app.globalData.peoplenum = that.peoplenum;
    app.globalData.namreasone = that.reason;
    wx.setStorage({
      key: 'key',
      data: [that.name, that.phone ,that.peoplenum,that.reason,],
      success: function (res) {
        console.log(res)
      }
    })

    wx.cloud.callFunction({
      name: "give_author",
      data: {
        name: that.name,
        phone: that.phone,
        peoplenum:that.peoplenum,
        reason:that.reason

      },
      success(res) {
        console.log("成功", res.result)
      },
      fail(res) {
        console.log("失败", res)
      }
    })
  },
})